package com.huanletao.spring.ioc;

import com.huanletao.quartz.entity.JobDetails;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.beans.factory.support.RootBeanDefinition;

/**
 * description: MyBeanDefinitionRegistryPostProcessor <br>
 * date: 2022/7/1 15:13 <br>
 * author: 踏雪无痕 <br>
 * version: 1.0 <br>
 */
@MeComponent
public class MyBeanDefinitionRegistryPostProcessor implements BeanDefinitionRegistryPostProcessor {

    /**
     *
     * @param registry
     * @throws BeansException
     */
    @Override
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
        System.out.println("MyBeanDefinitionRegistryPostProcessor.postProcessBeanDefinitionRegistry start--");

        RootBeanDefinition rootBeanDefinition = new RootBeanDefinition(JobDetails.class);
        registry.registerBeanDefinition("job",rootBeanDefinition);

    }

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    }
}
